News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Unused or deprecated script variables?

Started by calan, November 01, 2014, 03:21:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

calan

Are there any unused entity def variables that can be accessed in the scripts, and reused for other purposes?

If not, how easy is it to add a new variable to an entity def and then access it in the related script? SDK work I assume?
Old bastard but kid at heart...

BielBdeLuna

from the scripts you can access to any spawnarg you want with any sort of key

a "spawnarg" is the name of any of the variables you set up in either the definition files or the level editor like "health"

and the "key" is the actual variable value  "100" in "health" for the player

in the level editor you can set up whatever spawnarg you want to any entity and it's key at whatever value you want and then:

for a integer return you can use: $my_entity.getIntKey("pain_threshold"); (but it returns a float, as scripts only use floats)

for floats you can use: $my_entity.getFloatKey("blink_min");

for entity you can use: $my_entity.getEntityKey( "target" );

and for string you can use: string monster_class;
monster_class=$monster.getKey("className");


as you can find in modwiki

The Happy Friar

You can also make any entity & key/value at any time you wan, or use custom key/values in the editor.

IE for a func_static you can make a key/value in the editor called "Stupid/0".  Then in a script you can get that value and check the Stupid value (hehehe).

In scripting you can also make new entities and store any values you want in them.  IE you can make an entity called "doorcheck" and keep stats on how many doors the player walked through with it (that's a bad example as you can make a level wide variable in the level script to do the same thing).

It's pretty versatile in what you can do via scripting.

calan

Quote from: The Happy Friar on November 01, 2014, 06:43:00 PM

It's pretty versatile in what you can do via scripting.

I wish I had time to learn more about it. I have a lot of cool ideas I'd like to implement, but no time due to family, work, and other hobbies (shooting, fast cars, etc etc)....and time goes by faster every day.

Getting old sucks.  :)
Old bastard but kid at heart...