Start_Script(script, params)

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.
Post Reply
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Start_Script(script, params)

Post by DevGIB »

Ok i have a new problem to do with start script... well its not a problem i just dotn think its working how the scripter meant it to work... if someone could help me this would be greatly appreciated.

start_script line:

Code: Select all

start_script (":combat:"+hitscript, {attacker, defender, attacker.weapon, def_armor, wbasedamage, 0});
wil this work properly

Code: Select all

program mainhit(attacker, defender, weapon, armor, basedamage, rawdamage)
it seems as tho passing everything in an array it doesnt come through properly...
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm

Post by tekproxy »

You have to grab all of the params from the array like this:

Code: Select all

Start_Script(":combat:"+hitscript, array{attacker, defender, vbasedamage, 0})

Code: Select all

program mainHit(params)
	var attacker := params[1];
	var defender := params[2];
	var base_damage := params[3];
	var raw_damage := params[4];

	// Combat hooks are complicated, good luck!
	// Make sure it's as optimized as possible
	// You _could_ just use the combat hook in the distro...
One should not have to pass attacker.weapon or def_armor if one already has access to the attacker and defender mobile refrences, but if you do, just put them in.
Last edited by tekproxy on Sun Jul 02, 2006 9:24 am, edited 1 time in total.
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Post by DevGIB »

only problem is with that i now have to go and change every single hitscript to support that method, and the reason why we have to pass the weapons and armour and staff is because its appart of our attack hook and some files need it to retrieve props from the weapons and armour :(
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm

Post by tekproxy »

You do not need to pass attacker.weapon to the hit script if you are already passing the mobile refrence attacker. If you want to access attacker's weapon then do so with attacker.weapon in the hit script. If you ever use something other than attacker.weapon for the attacker's weapon then you would need to send the weapon but I don't think that's a good idea. It's your call. That's just how you use Start_Script(). Good luck!
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Post by DevGIB »

Thanks to Wywern from the IRC who provided this fix ill post it so if anyone else has questions about it they can check this out... (keeping support active)

Code: Select all

program mainhit(attacker, defender, weapon, armor, basedamage, rawdamage)

If(TypeOf(attacker) == "Array")
defender := attacker[2];
weapon := attacker[3];
armor := attacker[4];
basedamage := attacker[5];
rawdamage := attacker[6];
attacker:= attacker[1]; //Must Be Last To Keep Attacker relative to the hook for other parms above
endif
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm

Post by tekproxy »

What are you trying to do? Why do you start the script that way anyway?
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Post by DevGIB »

its a hitscript... we have an attack hook and in the attack hook the end of it, it calls the hitscript
how ever start_script() only allows you to send 1 parm not multiple
Post Reply